package org.kjtc.controller;

import org.kjtc.entity.State;
import org.kjtc.entity.WorkState;
import org.kjtc.service.SetUpService;
import org.kjtc.web.JsonResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.parsing.ParseState;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.persistence.criteria.CriteriaBuilder;
import java.util.HashMap;
import java.util.List;
import java.util.Map;


/**
 * Created by Administrator on 2017/12/13 0013.
 */
@RestController
public class SetUpController extends BaseController {

    @Autowired
    private SetUpService setUpService;

    @RequestMapping(value = "doGetAllState")
    public JsonResult doGetAllState(){
        List<State> list=setUpService.getAllState();
        return new JsonResult(list);
    }
    @RequestMapping(value = "doGetWorkState")
    public JsonResult doGetWorkState(){
        List<WorkState> list=setUpService.getWorkState();
        return new JsonResult(list);
    }
    @RequestMapping(value = "doCreateState")
    public JsonResult doCreateState(State state){
        int num=setUpService.createState(state);
        return new JsonResult(num);
    }
    @RequestMapping(value = "doDeleteState")
    public JsonResult doDeleteState(State state){
        int num=setUpService.deleteState(state);
        return new JsonResult(num);
    }
    @RequestMapping(value = "doUpdateWorkState")
    public JsonResult doUpdateWorkState(WorkState workState){
        int num=setUpService.updateWorkState(workState);
        return new JsonResult(num);
    }
    @RequestMapping(value = "doUpdateState")
    public JsonResult doUpdateState(String jsonStr){
        int num = setUpService.updateState(jsonStr);
        return new JsonResult(num);
    }
}
